package demo01;

import java.util.Arrays;
import java.util.Comparator;

public class Test01 {
    public static void main(String[] args) {
        Student[] students = new Student[3];
        students[0] = new Student("张三", 18, 90);
        students[1] = new Student("李四", 19, 80);
        students[2] = new Student("王五", 20, 70);

        System.out.println("按照成绩升序排序：");
        Arrays.sort(students, Comparator.comparingInt(Student::getScore));
        for (Student student : students) {
            System.out.println(student);
        }
    }
}
